      PROGRAM SAMDAT
      IMPLICIT REAL*8(A-H,O-Z)
C
      DIMENSION A(16),B(8),Q(16),R(4),ATIL(16),BTIL(8),QTIL(16),WTIL(8),
     *RTIL(4),FTIL(8),AHAT(16),QHAT(16),FHAT(8),DUMMY(116),P(16),F(8)
      DIMENSION NA(2),NB(2),NQ(2),NR(2),NATIL(2),NBTIL(2),NQTIL(2),NWTIL
     *(2),NRTIL(2),NFTIL(2),NAHAT(2),NQHAT(2),NFHAT(2),IOP(5),NP(2),NF(2
     *),NDUM(2)
C
      LOGICAL IDENT,DISC,NEWT,STABLE,FNULL
C
C
C      INPUT HOLLERITH DATA FOR TITLE OF OUTPUT
      CALL RDTITL
C
C      INPUT COEFFICIENT AND WEIGHTING MATRICES FOR CONTINUOUS SYSTEM
      CALL READ(4,A,NA,B,NB,Q,NQ,R,NR)
C
C
C      GENERATE EXP (A*DELT) AND (INTEGRAL EXP(A*TAU))*B
      DELT=.05
      IOP(1)=0
      N1 = (NA(1)**2)+1
C
      CALL EXPINT(A,NA,ATIL,NATIL,DUMMY,NDUM,DELT,IOP,DUMMY(N1))
      CALL MULT(DUMMY,NDUM,B,NB,BTIL,NBTIL)
      CALL PRNT(ATIL,NATIL,4HATIL,1)
      CALL PRNT(BTIL,NBTIL,4HBTIL,1)
C
C
C      GENERATE DIGITAL PERFORMANCE INDEX WEIGHTING MATRICES
      IOP(2)=1
      CALL EQUATE(Q,NQ,QTIL,NQTIL)
      CALL EQUATE(R,NR,RTIL,NRTIL)
      CALL SAMPL(A,NA,B,NB,QTIL,NQTIL,RTIL,NRTIL,WTIL,NWTIL,DELT,IOP,DUM
     *MY)
      CALL PRNT(QTIL,NQTIL,4HQTIL,1)
      CALL PRNT(WTIL,NWTIL,4HWTIL,1)
      CALL PRNT(RTIL,NRTIL,4HRTIL,1)
C
C
C      FIND PREFILTER GAIN WHICH ELEMINATES CROSS-PRODUCT TERM
C      IN DIGITAL PERFORMACNE INDEX
      IOP(3)=1
      CALL EQUATE(ATIL,NATIL,AHAT,NAHAT)
      CALL EQUATE(QTIL,NQTIL,QHAT,NQHAT)
      CALL PREFIL(AHAT,NAHAT,BTIL,NBTIL,QHAT,NQHAT,WTIL,NWTIL,RTIL,NRTIL
     *,FTIL,NFTIL,IOP,DUMMY)
      CALL PRNT(AHAT,NAHAT,4HAHAT,1)
      CALL PRNT(QHAT,NQHAT,4HQHAT,1)
      CALL PRNT(FTIL,NFTIL,4HFTIL,1)
C
C
C    SOLVE FOR F HAT
      IDENT= .TRUE.
      DISC = .TRUE.
      NEWT = .TRUE.
      STABLE = .FALSE.
      FNULL = .TRUE.
      ALPHA = .9
      IOP(1) = 1
      IOP(2) = 0
      IOP(3) = 0
      IOP(4)  = 1
      IOP(5) = 1
      CALL ASYREG(AHAT,NAHAT,BTIL,NBTIL,H,NH,QHAT,NQHAT,RTIL,NRTIL,FHAT
     *,NFHAT,P,NP,IDENT,DISC,NEWT,STABLE,FNULL,ALPHA,IOP,DUMMY)
      CALL ADD(FTIL,NFTIL,FHAT,NFHAT,F,NF)
C
C
C     OUTPUT F AND F HAT GAINS
      CALL LNCNT(10)
      WRITE(6,100)
  100 FORMAT('     FOR THE ORIGINAL SAMPLED-DATA PROBELM')
      CALL PRNT(FHAT,NFHAT,4HFHAT,1)
      CALL PRNT(F,NF,4HF   ,1)
C
C
      STOP
      END
